{ stdenv, pkgs, fetchFromGitHub }:

stdenv.mkDerivation rec {
  name = "yocto";
  version = "0.3";
  src = fetchFromGitHub {
    owner = "akrennmair";
    repo = "yocto";
    rev = "yocto-0.3";
    sha256 = "1v7w0bg0iz85wwd1j5pzcnz3xd6i8jf9dh581n75fzc2av06j5cx";
  };
  buildInputs = with pkgs; [ ncurses ];

  prePatch = ''
    substituteInPlace Makefile \
      --replace "/usr/local" "$out"
    substituteInPlace Makefile \
      --replace "-O2" "-Os"
  '';

  postInstall = ''
    strip --strip-all $out/bin/yocto
  '';
}
